/*
 * @author Mark Johnson
 *
 * Date: Thu Oct 14 23:10:06 2010 -0400
 */
 
$(document).ready(function(){
	$('table.selectable tbody tr').hover(
	 	function(){
	 		$(this).addClass('select-hover');
			 window.status = $(this).find('td.edit a').attr('href');
		},
		function(){
			$(this).removeClass('select-hover');
			window.status = '';
		}
	);
	
	$('table.selectable tbody tr').click(function(e){
		if (!$(e.target).hasClass('action-link'))
		{
			var link = $(this).find('td.edit a.edit');
			if (link.length > 0)
			{
				var href = $(link).attr('href');
				if (href.length > 0)
				{
					window.location = href;
				} 
			}
			
			return false;
		}
	});
	
	$('table.selected thead th').click(function(e){
		if (!$(e.target).hasClass('action-link'))
		{
			var link = $(this).find('a.sort');
			if (link.length > 0)
			{
				var href = $(link).attr('href');
				if (href.length > 0)
				{
					window.location = href;
				} 
			}
			
			return false;
		}
	});
});
